/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import session.manager.ConstructManagerBeanLocal;
import session.manager.PlayerManagerBeanLocal;
import session.manager.ResourceManagerBeanLocal;

/**
 *
 * @author antonio
 */
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class SignUpBean implements SignUpBeanLocal {
    
    @EJB
    private PlayerManagerBeanLocal playerManager;
    
    @EJB
    private ResourceManagerBeanLocal resourceManager;
    
    @EJB
    private ConstructManagerBeanLocal constructManager;

    @Override
    public boolean signup(String username, String password, String email) {
        if(! playerManager.initPlayer(username, password, email)) {
            return false;
        } 
        resourceManager.initResources(username);
        constructManager.initConstructs(username);
        return true;
    }

}
